<head>
<script>
let useAlternateContent = false;

let sz = 2;
let color = 255;

function tick() {
  let canvas = document.getElementById('canvas');
  let c = canvas.getContext('2d');
  if (useAlternateContent) {
    let fillStyle = 'rgba(' + color + ',0,0,1.0)';
    c.fillStyle = fillStyle;
    --color;
  } else {
    c.fillStyle = 'rgba(255,255,255,1.0)';
  }
  useAlternateContent = !useAlternateContent;
  c.fillRect(0, 0, sz, sz);
  setTimeout(tick, 1000);
}

function main() {
  if (window.domAutomationController) {
    domAutomationController.send("FINISHED");
  }

  let canvas = document.getElementById('canvas');
  canvas.width = sz;
  canvas.height = sz;

  // This page is used in the main tab in a couple of dual-GPU tests
  // on macOS. When running on the passthrough command decoder and
  // ANGLE, ANGLE can only detect the need to switch GPUs upon context
  // switch. Schedule a small amount of periodic rasterization work so
  // that context switches occur in the GPU process.
  setTimeout(tick, 1000);
}
</script>
</head>
<body onload="main()">
<canvas id="canvas"></canvas>
</body>
